package com.example.webupload.util;

/**
 * <p>Title: FileTypeUtil</p>
 * <p>Description: </p>
 *
 * @author Lau
 * @date 2025/4/1 15:43
 */
public class FileTypeUtil {
    public static String getFileType(String extension) {
        if (extension == null || extension.isEmpty()) {
            return "Unknown";
        }
        extension = extension.toLowerCase();
        // 根据扩展名判断文件类型
        switch (extension) {
            case "jpg":
            case "jpeg":
            case "png":
            case "gif":
                return "Image";
            case "pdf":
                return "PDF";
            case "doc":
            case "docx":
                return "Word Document";
            case "xls":
            case "xlsx":
                return "Excel Spreadsheet";
            case "ppt":
            case "pptx":
                return "PowerPoint Presentation";
            case "zip":
            case "rar":
                return "Archive";
            case "txt":
                return "Text File";
            default:
                return "Other";
        }
    }
}
